import request from '@/utils/request'
// 获取员工简单列表
export const getEmployeeSimple = () => request.get(`/sys/user/simple`)
// 获取员工信息
export const getEmployeeList = (params) => request.get(`/sys/user`, { params })
// 删除员工
export const delEmployee = (id) => request.delete(`/sys/user/${id}`)
// 新增员工
export const addEmployee = (data) => request.post(`/sys/user`, data)
// 导入员工
export const importEmployee = (data) => request.post('/sys/user/batch', data)
// 保存员工基本信息
export const saveUserDetail = (data) => request.put(`/sys/user/${data.id}`, data)

// 获取员工详细信息
export const getEmployeeDetail = id => request.put(`/employees/${id}/personalInfo`)

// 保存员工详细信息
export const saveEmployeeDetail = data => request({
  url: `/employees/${data.userId}/personalInfo`,
  method: 'PUT',
  data
})
// 获取用户的岗位信息
export const getJobDetail = id => request.get(`/employees/${id}/jobs`)
// 获取用户的岗位信息
// export function getJobDetail(id) {
//   return request({
//     url: `/employees/${id}/jobs`,
//   })
// }

// 保存岗位信息
// export function saveJobDetail(data) {
//   return request({
//     url: `/employees/${data.userId}/jobs`,
//     method: 'put',
//     data
//   })
// }
export const saveJobDetail = data => request.put(`/employees/${data.userId}/jobs`)

